package com.palnar.ilecker;

import java.util.ArrayList;
import java.util.Arrays;

import org.ksoap2.serialization.SoapObject;

import com.palnar.ilecker.manager.AllServiceManager;
import com.palnar.ilecker.manager.NotifyManager;
import com.palnar.ilecker.manager.ServiceManager;
import com.palnar.ilecker.manager.AllServiceManager.SoapWithArgsListener;
import com.palnar.ilecker.manager.ServiceManager.DataDownloadListener;
import com.palnar.ilecker.model.ServiceManagerModel;
import com.palnar.ilecker.model.User;
import com.palnar.ilecker.utils.Utils;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class TestActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_test);
	}

	/*Service Manager Example*/
	
	
	/*String name[] = { "username", "password" };
	ArrayList<Object> value = new ArrayList<Object>();
	value.add(edtUserName.getText().toString());
	value.add(edtPassword.getText().toString());
	

	serviceManager = new ServiceManager(USER_SERVICE_WSDL, name, value,
			METHOD_GETUSER, SOAP_ACTION_FOR_GETUSER, progress);

	serviceManager.setServiceListener(new DataDownloadListener() {

		public void dataDownloadedSuccessfully(SoapObject result) {
			// TODO Auto-generated method stub

			System.out.println("RESPONSe Success");

			user = User.UserTypeBuilder(result);

			if (user.GetId() != 0) {

				NotifyManager.showLongToast(context,getString(R.string.login_success));
										
			} 
			else {
				
				NotifyManager.showLongToast(context,
						getString(R.string.login_err));
			}

		}

		public void dataDownloadedFailed(String error) {
			NotifyManager.showLongToast(context,getString(R.string.common_error_message));
		}
	});

	serviceManager.execute();*/
	
	
	
	
	/*AllServiceManager Example*/
	
	/*ServiceManagerModel getUser=new ServiceManagerModel(USER_SERVICE_WSDL, METHOD_GETUSER, SOAP_ACTION_FOR_GETUSER, new ArrayList(Arrays.asList("username","password")), new ArrayList(Arrays.asList(edtUserName.getText().toString(),edtPassword.getText().toString())));
	 
	
	allServiceManager=new AllServiceManager( new ArrayList<ServiceManagerModel>(Arrays.asList(getUser)), progress);
				
				allServiceManager.setAllWithServiceListener(new SoapWithArgsListener() {
					
					@Override
					public void dataDownloadedSuccessfully(ArrayList<SoapObject> result,
							ArrayList<String> method) {

						
						
						for (SoapObject serviceManagerModel : result) {
							
							//System.out.println("RESULT  "+serviceManagerModel.size());
							Utils.longInfo(serviceManagerModel.toString());
						}
						
					}
					
					@Override
					public void dataDownloadedFailed(String error) {
						System.out.println("FAILED   "+error);
						
					}
				});
				
				allServiceManager.execute();*/

}
